﻿@model ZSZ.DTO.HousePicDTO[]
@{
    ViewBag.Title = "房源图片";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 图片管理 <span class="c-gray en">&gt;</span> 图片展示 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="pd-20">
    <div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"> <a href="/House/HousePicAdd/@ViewBag.houseId" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe6df;</i> 添加</a> <a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a> </span> <span class="r">共有数据：<strong>@Model.Length</strong> 条</span> </div>
    <div class="portfolio-content">
        <form id="formDate">
            <ul class="cl portfolio-area">
                @foreach (var item in Model)
                {
                    <li class="item">
                        <div class="portfoliobox">
                            <input class="checkbox" name="ids" type="checkbox" value="@item.Id">
                            <div class="picbox"><a href="@item.Url" data-lightbox="gallery"><img src="@item.ThumbUrl"></a></div>
                            <div class="textbox">@item.Id</div>
                        </div>
                    </li>
                }
            </ul>
        </form>
    </div>
</div>
@section footerjs{
    <script type="text/javascript">
        function datadel() {
            var formData = $('#formDate').serializeArray();
            if (formData.length < 1) {
                alert('请选择图片哎？');
                return;
            }
            $.ajax({
                url: '/House/DeltePicIds',
                data: formData,
                type: 'post',
                dataType: 'json',
                success: function (res) {
                    if (res.status == 'ok') {
                        window.location.reload();
                    } else {
                        alert(res.errMsg);
                    }
                },
                error: function () {
                    alert('网络请求错误');
                }
            })
        }
    </script>
}